<template>
  <div class="relative w-full h-full">
    <div class="flex_aic_jcsb">
      <el-radio-group v-model="type" class="mb12">
        <el-radio-button label="已缴纳年费商家" value="1" />
        <el-radio-button label="到期未缴纳年费商家" value="2" />
      </el-radio-group>
      <el-button type="primary" @click="editDiaVisible = true"
        >年费金额设置</el-button
      >
    </div>

    <SearchCom
      :searchList="searchConfig"
      @search="handleSearch"
      @reset="handleReset"
    />

    <el-table
      :data="tableData"
      style="width: 100%"
      class="cover-table mt12"
      height="calc(100% - 200px)"
      border
    >
      <el-table-column label="序号" width="80">
        <template #default="scope">
          <span>{{ scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="name" label="商户名称" />
      <el-table-column prop="id" label="商户ID" />
      <el-table-column prop="concat_phone" label="商户联系方式" />
      <el-table-column prop="price" label="缴纳金额" />
      <el-table-column prop="create_time" label="缴纳时间" />
      <el-table-column prop="status" label="缴纳状态">
        <template #default="scope">
          <span class="color-555555">{{ scope.row.status }}</span>
        </template>
      </el-table-column>
    </el-table>

    <div class="flex justify-end mt24 absolute bottom-0 right-0">
      <el-pagination
        v-model:current-page="currentPage"
        v-model:page-size="pageSize"
        :page-sizes="[10, 20, 30, 40]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="400"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </div>
    <EditDia v-model="editDiaVisible" :data="editDiaData"></EditDia>
  </div>
</template>

<script setup>
import { ref } from "vue";
import EditDia from "./editDia.vue";
import SearchCom from "@/components/searchCom.vue";
const filters = ref({
  searchKey: "",
  status: "",
  date: [],
});
const searchConfig = ref([
  {
    label: "缴纳时间",
    key: "date",
    type: "daterange",
  },
  {
    label: "关键词",
    key: "searchKey",
    type: "input",
  },
  {
    label: "缴纳状态",
    key: "status",
    type: "select",
    options: [
      { label: "即将到期", value: 1 },
      { label: "到期未缴纳", value: 2 },
      { label: "已缴纳", value: 3 },
    ],
  },
]);
const type = ref("1");
const editDiaVisible = ref(false);
const editDiaData = ref({});
const currentPage = ref(1);
const pageSize = ref(10);
const tableData = ref(
  Array(10).fill({
    name: "商户名称",
    id: "商户ID",
    concat_phone: "商户联系方式",
    price: "10000",
    create_time: "2024-01-01 12:00:00",
    status: "即将到期",
  })
);
const handleDelete = (row) => {
  console.log(row);
};
const handleEdit = (row) => {
  editDiaVisible.value = true;
  editDiaData.value = JSON.parse(JSON.stringify(row));
};
const handleSizeChange = (size) => {
  pageSize.value = size;
};
const handleCurrentChange = (page) => {
  currentPage.value = page;
};
</script>

<style lang="scss" scoped>
.addBtn {
  height: 28px;
  margin-left: 10px;
  padding: 0 7px;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}
.split {
  width: 1px;
  height: 12px;
  background: #ddd;
  margin: 0 5px;
}
</style>
